// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'

import App from './App'
import router from './router'
import { createStore } from './store/index'
import ElementUI from 'element-ui'
import './assets/css/index.css'
import './assets/iconfont/iconfont.css'
import 'element-ui/lib/theme-chalk/index.css'
import VueParticles from 'vue-particles'
import VueI18n from 'vue-i18n'
import LangCh from '../static/lang/ch'
import LangEn from '../static/lang/en'
import echarts from 'echarts'
import md5 from 'js-md5';
Vue.prototype.$md5 = md5;
Vue.prototype.$echarts = echarts
Vue.prototype.$axios = axios;

Vue.prototype.$allId = {
    guid:"001"
} 
import axios from 'axios';
Vue.use(VueI18n)
const i18n = new VueI18n({
    locale: (function () {
        if (localStorage.getItem('lang')) {
            return localStorage.getItem('lang')
        }
        return 'ch'
    }()),

    messages: {
        'ch': LangCh,
        'en': LangEn
    }
})


// router.beforeEach((to, from, next) => {
//     next();
    
//     if (JSON.parse(window.sessionStorage.getItem('user')) == "" || JSON.parse(!window.sessionStorage.getItem('user'))) {
//         next({
//             path: "/Login"
//         })
//     }
//     else {
//         next();
//     }

// });
Vue.use(VueParticles)
Vue.use(ElementUI)
Vue.config.productionTip = false;
let store = createStore()
Vue.prototype.$store = store;
/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    i18n,
    store,
    components: {
        App
    },
    template: '<App/>'
})